<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    body{
      margin:0;
    }

    .main-container{
      max-width:600px;
      margin:0 auto;
      border:solid 10px green;
      padding:10px;
      margin-top:40px;
      min-height:1000px;
    }

    .main-header{
      height:50px; background:#aaa;
    }

    .main-content{
      min-height:1000px;
      background: pink;
    }

    .main-footer{
      position:-webkit-sticky; position:sticky; bottom:33px;
    }
  </style>
</head>
<body>

<div class="main-container">
  <header class="main-header"></header>
  <div class="main-content"></div>

  <!--
    当↓的元素距离视口底部33px 或则 小于33px时 sticky, sticky的距离就是距离底部33px
  -->
  <div class="main-footer" style="position:-webkit-sticky; position:sticky; bottom:33px;">
    <span>🌭 向上收起</span>
  </div>

  <!--
    不在↓加几个br的话, 那元素距离视口底部永远是小于等于33px的 就永远是sticky状态
  -->
  <br><br><br><br><br><br>
</div>


</body>
</html>
